﻿using Loong.Threading.Locks;
using Microsoft.Extensions.DependencyInjection;

namespace Loong.Redis.Threading.Locks
{
    public static class RedisLockExtensions
    {
        public static IServiceCollection AddRedisLock(this IServiceCollection services)
        {
            services.AddSingleton<ILockFactory, RedisLockFactory>();
            services.Configure<RedisOptions>(options =>
            {
                options.UseRedis = true;
            });

            return services;
        }
    }
}
